import java.util.Scanner;

//判断一个数是否是水仙花数，所谓水仙花数是指一个三位数，其各个位上数字立方和等于其本身
//例如：153 = 1*1*1 + 3*3*3 + 5*5*5
public class Homework06 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个三位数：");
        String digit = scanner.next();
        int digit1 = Integer.parseInt(String.valueOf(digit.charAt(0)));
        int digit2 = Integer.parseInt(String.valueOf(digit.charAt(1)));
        int digit3 = Integer.parseInt(String.valueOf(digit.charAt(2)));
        int sum = (digit1 * digit1 * digit1) + (digit2 * digit2 * digit2) + (digit3 * digit3 * digit3);
        int transform = Integer.parseInt(digit);
        if (sum == transform) {
            System.out.println("该数字是水仙花数！");
        } else {
            System.out.println("该数字不是水仙花数！");
        }
    }
}
